#include "config.h"
#include <stdio.h>
#include "../Dictionary/dictionary.h"

int CargarParametros(const char * fileName, Dictionary * dictionary)
{
/*
Sintaxis:
	item valor
*/
   FILE *configFile; 
   char item[30];
   char valor[30];	

   if ((configFile = fopen(fileName, "r")) != NULL)
   {
	   while(fscanf(configFile, "%s", item) != EOF)
	   {
		   if (Dictionary_Index(dictionary, item, NULL) > 0)
		   {
			   fscanf(configFile, " %s", valor);
			   //Dictionary_SetKey(dictionary, item, valor);
			   Dictionary_Delete(dictionary, item);
			   Dictionary_Add(dictionary, item, valor);
		   }
	   }
   } else
	   return -1;
   
   fclose(configFile);
   return 0;
}
